import { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';

@Component({
  selector: 'app-qrcode-container',
  templateUrl: './qrcode-container.component.html',
  styleUrl: './qrcode-container.component.css'
})
export class QrcodeContainerComponent implements OnDestroy {
  @Input() url = '';
  @Output() clickEvent = new EventEmitter();
  
  constructor(private message: NzMessageService) { }

  size = 330;
  rzStop(e: any) {
    const { height = 0, width = 0 } = e.size;
    this.size = (height > width ? width : height) - 30;
  }

  clickHandle() {
    this.clickEvent.emit()
  }

  ngOnDestroy(): void {
    this.message.warning('二维码已关闭')
  }
}
